import { isUrlString } from '@sindresorhus/is';

export const pathResolve = (parentPath: string, path: string) => {
  if (isUrlString(path)) {
    return path;
  }

  const childPath = path.startsWith('/') || !path ? path : `/${path}`;
  return `${parentPath}${childPath}`.replace(/\/\//g, '/').trim();
};
